<%@ page language="java" contentType="text/html;charset=UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = path + "/resource/extjs/skins/default";
%>
<html>
	<head>
		<jsp:include page="/common.jsp" />
		<!-- include common.jsp -->
		<base />
		<script type="text/javascript">
			var classId='<%=request.getParameter("classId")%>' ;
		</script>
		<script type="text/javascript">
		var basePath='<%=basePath%>';
		var path='<%=path%>';
		var updateClassify;
		var tree=window.parent.Ext.getCmp("classTree");
		function updateClass(){
			updateClassify.getForm().submit({
				url:path+'/classify/updateFirstClassify.do',
				waitMsg:'load...',
				success:function(){
				tree.root.reload();
				}	
			})
		}
	    Ext.onReady(function(){
    	updateClassify = new Ext.form.FormPanel({
				border : false,
				renderTo:'updateSecondClass',
				frame:true,
				border:false,
				width:450,
				defaultType: 'textfield',
				bodyStyle:'padding:10px 5px 0 20px',
				defaults: {width: 230},
				reader:new Ext.data.JsonReader({
					root:'data',
					successProperty:'success'
				},[
						{name: 'classId',mapping:'firstClassId'},
				        {name: 'className',mapping:'className'},
				        {name: 'classDesc',mapping:'classDesc'},
				        {name: 'displayOrder',mapping:'displayOrder'},
				        {name: 'state',mapping:'state'}
				    ]),
				items : [{
						hidden:true,
						name:"classId"
					},{
		                fieldLabel: '分类名称',
		                name: 'className',
		                allowBlank:false
		            },{
		                fieldLabel: '描述',
		                name: 'classDesc'
		            },{
		                fieldLabel: '顺序',
		                name: 'displayOrder'
		            },{
		            	xtype: 'radiogroup',
			            fieldLabel: '激活',
			            name:'state',
			            items: [
			                {boxLabel: '是', name: 'state', inputValue: 1},
			                {boxLabel: '否', name: 'state', inputValue: 0}
			            ]
		            }],
		            buttons:[{
		            	text:'修改',
		            	handler:updateClass
				}]
			});
			updateClassify.getForm().load({
				url:path+"/classify/loadFirstClassify.do",
				params:{"classId":classId}
			});
		});
		</script>
	</head>
	<body>
		<style>
			body {
			margin: 0;
			padding: 0 0 12px 0;
			font-size: 12px;
			line-height: 22px;
			font-family: "宋体", "Arial Narrow";
			background: #fff;
		}
		</style>
		<div id="updateSecondClass">
		</div>
	</body>
</html>
